<?php

namespace App\Models;

class HousingsOrder extends Model
{
    protected $fillable = [
        'field_name',
    ];
    protected $table = 'housings_order';
    protected $orderType = [1=>'已预定',2=>'已入住',3=>'已退房',4=>'已取消'];
    public function getOrderTypeAttribute($value)
    {
        return isset($this->orderType[$value]) ? $this->orderType[$value] : reset($this->orderType);
    }

    public function user()
    {
        return $this->hasOne(AppUser::class,'id','user_id');
    }

    public function housings()
    {
        return $this->hasOne(Housings::class,'id','housings_id');
    }
    public function enterlog()
    {
        return $this->hasOne(EnterLog::class,'id','enter_log_id');
    }
}
